<template>
  <el-page-header @back="goBack"> </el-page-header>
  <div>
    <v-md-preview :text="text"></v-md-preview>
  </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import request from '@/utils/request'

const text = ref(` `)
onMounted(() => {
  const router = useRoute()
  getArticleInfoById(router.query.id)
})

const getArticleInfoById = (id: any) => {
  request('/find', { id }).then((data) => {
    text.value = data
  })
}
const router = useRouter()
const goBack = () => {
  router.back()
}
</script>

<style scoped>
.v-md-editor-preview {
  width: 1280px;
}

.github-markdown-body {
  font-family: 'AlimamaDaoLiTi', fangsong;
}

.el-page-header {
  margin-left: 30px;
  margin-top: 20px;
  margin-bottom: 10px;
}
</style>
